<!DOCTYPE html>
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>highlight.d</title>
<meta name="generator" content="KF5::SyntaxHighlighting (D)"/>
</head><body style="color:#1f1c1b"><pre>
<span style="color:#898887;">/********</span>
<span style="color:#898887;">*</span><span style="color:#7f7fff;"> Highlight testing module.</span>
<span style="color:#898887;">*</span>
<span style="color:#898887;">*</span><span style="color:#7f7fff;"> Do not attempt to run this!</span>
<span style="color:#898887;">***********/</span>
<span style="color:#008000;font-weight:bold;">module</span><span style="color:#008000;"> highlighttest</span>;
<span style="color:#008000;font-weight:bold;">import</span><span style="color:#008000;"> X = null</span>;

<span style="color:#898887;">/++</span><span style="color:#7f7fff;"> Pragma directives. DDoc + DDoc embedded items. Special Tokens.</span>
<span style="color:#898887;">+</span>
<span style="color:#898887;">+</span><span style="color:#7f7fff;"> </span><span style="color:#898887;">---</span>
<span style="color:#898887;">+</span><span style="font-style:italic;"> </span><span style="color:#898887;">// comment</span>
<span style="color:#898887;">+</span><span style="font-style:italic;"> </span><span style="color:#00aa00;font-weight:bold;">#line </span><span style="color:#b08000;">12</span><span style="color:#00aa00;font-weight:bold;"> </span><span style="color:#bf0303;">&quot;hightlighttest.d&quot;</span><span style="color:#00aa00;font-weight:bold;">	</span><span style="color:#898887;">/* block comment */</span>
<span style="color:#898887;">+</span><span style="font-style:italic;"> </span><span style="color:#00aa00;font-weight:bold;">#line </span><span style="color:#00aa00;">__LINE__</span><span style="color:#00aa00;font-weight:bold;"> </span><span style="color:#00aa00;">__FILE__</span><span style="color:#00aa00;font-weight:bold;">	</span><span style="color:#898887;">/++</span><span style="color:#7f7fff;"> embedded block comment </span><span style="color:#898887;">+/</span>
<span style="color:#898887;">+</span>
<span style="color:#898887;">+</span><span style="font-style:italic;"> </span><span style="color:#00aa00;font-weight:bold;">pragma </span><span style="color:#898887;">/* */</span><span style="color:#00aa00;font-weight:bold;"> </span>(<span style="font-weight:bold;">msg</span>,<span style="color:#00aa00;font-weight:bold;"> </span><span style="color:#bf0303;">&quot;what?&quot;</span>);
<span style="color:#898887;">+</span><span style="font-style:italic;"> </span><span style="color:#00aa00;font-weight:bold;">pragma</span>(<span style="color:#898887;">/++</span><span style="color:#7f7fff;"> </span><span style="color:#898887;">+/</span><span style="color:#00aa00;font-weight:bold;"> </span><span style="font-weight:bold;">lib</span>,<span style="color:#00aa00;font-weight:bold;"> </span><span style="color:#bf0303;">&quot;insane.a&quot;</span>);
<span style="color:#898887;">+</span><span style="font-style:italic;"> </span><span style="color:#00aa00;font-weight:bold;">pragma</span>(<span style="font-weight:bold;">inline</span>);
<span style="color:#898887;">+</span><span style="font-style:italic;"> </span><span style="color:#00aa00;font-weight:bold;">pragma</span>(<span style="font-weight:bold;">linkerDirective</span>);
<span style="color:#898887;">+</span><span style="font-style:italic;"> </span><span style="color:#00aa00;font-weight:bold;">pragma</span>(<span style="font-weight:bold;">mangle</span>);
<span style="color:#898887;">+</span><span style="font-style:italic;"> </span><span style="color:#00aa00;font-weight:bold;">pragma</span>(<span style="font-weight:bold;">startaddress</span>);
<span style="color:#898887;">+</span><span style="font-style:italic;"> </span><span style="color:#00aa00;font-weight:bold;">pragma</span>(D_Custom_Extension,<span style="color:#00aa00;font-weight:bold;"> </span><span style="color:#bf0303;">&quot;custom data&quot;</span>);
<span style="color:#898887;">+</span><span style="font-style:italic;"> </span><span style="color:#00aa00;font-weight:bold;">pragma</span>(foo<span style="color:#00aa00;font-weight:bold;"> </span><span style="color:#bf0303;text-decoration:underline;">0</span>);
<span style="color:#898887;">+</span><span style="font-style:italic;"> </span><span style="color:#898887;">---</span>
<span style="color:#898887;">+/</span>

<span style="color:#898887;">///</span><span style="color:#7f7fff;"> version condition</span>
<span style="color:#808000;font-weight:bold;">version</span> = X;
<span style="color:#808000;font-weight:bold;">version</span> = <span style="color:#b08000;">1_2_3</span>;
<span style="color:#808000;font-weight:bold;">version</span> (X) ;
<span style="color:#808000;font-weight:bold;">version</span>(<span style="font-weight:bold;">linux</span>) {}

<span style="color:#898887;">///</span><span style="color:#7f7fff;"> linkage</span>
<span style="color:#808000;font-weight:bold;">extern</span>
    (<span style="font-weight:bold;">C</span>) {}
<span style="color:#808000;font-weight:bold;">extern</span> :
;
<span style="color:#808000;font-weight:bold;">extern</span> (<span style="font-weight:bold;">C++</span>) {}
<span style="color:#808000;font-weight:bold;">extern</span> (<span style="font-weight:bold;">C++</span>, foo.bar.baz) {}
<span style="color:#808000;font-weight:bold;">extern</span> (<span style="font-weight:bold;">D</span>) {}
<span style="color:#808000;font-weight:bold;">extern</span> (<span style="font-weight:bold;">Windows</span>) {}
<span style="color:#808000;font-weight:bold;">extern</span> (<span style="font-weight:bold;">Pascal</span>) {}
<span style="color:#808000;font-weight:bold;">extern</span> (<span style="font-weight:bold;">System</span>) {}
<span style="color:#808000;font-weight:bold;">extern</span> (<span style="color:#bf0303;text-decoration:underline;">unknown</span>) {}
<span style="color:#808000;font-weight:bold;">extern</span> (<span style="font-weight:bold;">C</span><span style="color:#bf0303;text-decoration:underline;">,</span>) {}
<span style="color:#808000;font-weight:bold;">extern</span> (<span style="font-weight:bold;">C++</span>, foo<span style="color:#bf0303;text-decoration:underline;">,</span> bar) {}

<span style="color:#898887;">///</span><span style="color:#7f7fff;"> alias &amp; typedef</span>
<span style="color:#800000;font-weight:bold;">alias</span> <span style="color:#0057ae;">int</span>.<span style="color:#000080;">min</span> minint;
<span style="color:#800000;font-weight:bold;">typedef</span> <span style="color:#0057ae;">int</span> myint;

<span style="color:#0057ae;">int</span> main(<span style="color:#0057ae;">char</span>[][] args) {
    <span style="color:#898887;">///</span><span style="color:#7f7fff;"> statements</span>
    <span style="font-weight:bold;">if</span> (<span style="color:#b08000;">1</span>) {}
    <span style="font-weight:bold;">else</span> {}
    <span style="font-weight:bold;">with</span> (N) {x = B}
    
    <span style="color:#898887;">///</span><span style="color:#7f7fff;"> attributes</span>
    <span style="color:#800080;font-weight:bold;">auto</span> x = <span style="color:#b08000;">1</span>;
    <span style="color:#800080;font-weight:bold;">static</span> <span style="font-weight:bold;">if</span> (<span style="color:#000080;font-weight:bold;">true</span>) {}
    <span style="color:#0057ae;">void</span> (<span style="color:#000080;font-weight:bold;">in</span> X, <span style="color:#800080;font-weight:bold;">out</span> Y) {}	<span style="color:#898887;">// </span><span style="color:#81ca2d;background-color:#f7e6e6;font-weight:bold;">NOTE</span><span style="color:#898887;">: using in like this is rare, more common to use as an expression and no way to tell apart?</span>
    
    <span style="color:#898887;">///</span><span style="color:#7f7fff;"> deprecated</span>
    <span style="color:#800080;font-weight:bold;text-decoration:line-through;">deprecated</span> <span style="color:#0057ae;">void</span> fct ();
    
    <span style="color:#898887;">///</span><span style="color:#7f7fff;"> types</span>
    <span style="color:#0057ae;">void</span> a;
    <span style="color:#0057ae;">ushort</span> u;
    <span style="color:#0057ae;">int</span>[<span style="color:#0057ae;">uint</span>] AA;
    <span style="color:#800000;font-weight:bold;">class</span> C;
    <span style="color:#800000;font-weight:bold;">enum</span> N : <span style="color:#0057ae;">int</span> { A = <span style="color:#b08000;">5</span>, B }
    <span style="color:#0057ae;">typeof</span>(u) u2;
    
    <span style="color:#898887;">///</span><span style="color:#7f7fff;"> expressions</span>
    x = <span style="color:#000080;font-weight:bold;">cast</span>(<span style="color:#0057ae;">int</span>) <span style="color:#b08000;">55</span>;
    <span style="color:#0057ae;">void</span>* p = <span style="color:#000080;font-weight:bold;">null</span>;
    p = <span style="color:#000080;font-weight:bold;">cast</span>(<span style="color:#0057ae;">void</span>*) <span style="color:#000080;font-weight:bold;">new</span> <span style="color:#0057ae;">int</span>;
    x = <span style="color:#b08000;">1</span> <span style="color:#000080;font-weight:bold;">in</span> AA;	<span style="color:#898887;">// </span><span style="color:#81ca2d;background-color:#f7e6e6;font-weight:bold;">NOTE</span><span style="color:#898887;">: a THIRD use of in. How to detect??</span>
    <span style="color:#000080;font-weight:bold;">assert</span> (<span style="color:#000080;font-weight:bold;">true</span>);
        
    <span style="color:#898887;">///</span><span style="color:#7f7fff;"> libsymbols</span>
    <span style="color:#644a9b;font-weight:bold;font-style:italic;">string</span> s = <span style="color:#bf0303;">&quot;&quot;</span>;
    <span style="font-weight:bold;">throw</span> <span style="color:#000080;font-weight:bold;">new</span> <span style="color:#644a9b;font-weight:bold;font-style:italic;">Exception</span>;
    <span style="color:#644a9b;font-weight:bold;font-style:italic;">TypeInfo</span> ti = <span style="color:#000080;font-weight:bold;">typeid</span>(<span style="color:#0057ae;">int</span>);
    
    <span style="color:#898887;">///</span><span style="color:#7f7fff;"> tests</span>
    <span style="color:#ff00ff;font-weight:bold;">debug</span> {}
    <span style="color:#ff00ff;font-weight:bold;">debug</span> (<span style="color:#b08000;">2</span>) {}
    <span style="color:#ff00ff;font-weight:bold;">debug</span> (DSymb) {}
    <span style="color:#ff00ff;font-weight:bold;">unittest</span> {}
    
    <span style="color:#898887;">///</span><span style="color:#7f7fff;"> scope (as attribute and as statement)</span>
    <span style="color:#800080;font-weight:bold;">scope</span> <span style="color:#800000;font-weight:bold;">struct</span> S;
    <span style="font-weight:bold;">scope </span>(<span style="color:#000080;font-weight:bold;">exit</span>) {}
    <span style="color:#800080;font-weight:bold;">scope</span> 
     (success) {}	<span style="color:#898887;">// </span><span style="color:#81ca2d;background-color:#f7e6e6;font-weight:bold;">NOTE</span><span style="color:#898887;">: rules cannot match across new-lines</span>
    <span style="font-weight:bold;">scope </span>(<span style="color:#000080;font-weight:bold;">failure</span>) {}
    
    <span style="color:#898887;">///</span><span style="color:#7f7fff;"> Properties</span>
    x = <span style="color:#0057ae;">int</span>.<span style="color:#000080;">min</span>;
    s = (<span style="color:#b08000;">5</span>-<span style="color:#b08000;">3</span>).<span style="color:#000080;">stringof</span>;
    
    <span style="color:#898887;">///</span><span style="color:#7f7fff;"> strings</span>
    s = <span style="color:#bf0303;">r&quot;raw string&quot;</span>;
    s = <span style="color:#ff5500;">x&quot;00FF&quot;</span>;
    s = <span style="color:#3daee9;">\n</span> <span style="color:#3daee9;">\a</span>;
    s = <span style="color:#3daee9;">\u1234</span>;
    s = <span style="color:#3daee9;">\U12345678</span>;
    s = <span style="color:#3daee9;">\&amp;amp;</span> ;
    <span style="color:#0057ae;">char</span> c = <span style="color:#924c9d;">'a'</span>;
    s = <span style="color:#bf0303;">&quot;abc 012 </span><span style="color:#3daee9;">\&quot;</span><span style="color:#bf0303;"> </span><span style="color:#3daee9;">\n</span><span style="color:#bf0303;"> </span><span style="color:#3daee9;">\x12</span><span style="color:#bf0303;"> </span><span style="color:#3daee9;">\u1234</span><span style="color:#bf0303;"> </span><span style="color:#3daee9;">\U12345678</span><span style="color:#bf0303;">&quot;</span>;
    s = <span style="color:#ff5500;">`BQString '&quot;`</span>;
    s = <span style="font-weight:bold;">q{</span>foo <span style="color:#bf0303;">&quot;bar&quot;</span> <span style="color:#b08000;">123</span><span style="font-weight:bold;">}</span>;
    s = <span style="font-weight:bold;">q&quot;FOO</span>
<span style="color:#bf0303;">foo</span>
<span style="font-weight:bold;">FOO&quot;</span>;
    s = <span style="font-weight:bold;">q&quot;[</span><span style="color:#bf0303;">foo [bar] q&quot;[baz]&quot;</span><span style="font-weight:bold;">]&quot;</span>;
    s = <span style="font-weight:bold;">q&quot;(</span><span style="color:#bf0303;">foo (bar) q&quot;(baz)&quot;</span><span style="font-weight:bold;">)&quot;</span>;
    s = <span style="font-weight:bold;">q&quot;&lt;</span><span style="color:#bf0303;">foo &lt;bar&gt; q&quot;&lt;baz&gt;&quot;</span><span style="font-weight:bold;">&gt;&quot;</span>;
    s = <span style="font-weight:bold;">q&quot;{</span><span style="color:#bf0303;">foo {bar} q&quot;{baz}&quot;</span><span style="font-weight:bold;">}&quot;</span>;
    s = <span style="font-weight:bold;">q&quot;/</span><span style="color:#bf0303;">foo</span><span style="font-weight:bold;">/&quot;</span>;
    s = <span style="font-weight:bold;">q&quot;!</span><span style="color:#bf0303;">foo</span><span style="font-weight:bold;">!&quot;</span>;
    
    <span style="color:#898887;">///</span><span style="color:#7f7fff;"> region markers</span>
    <span style="color:#0057ae;background-color:#e0e9f8;">//BEGIN x</span>
    <span style="color:#0057ae;background-color:#e0e9f8;">//END x</span>
    
    <span style="color:#898887;">///</span><span style="color:#7f7fff;"> DDoc</span>
    <span style="color:#898887;">/*******</span>
<span style="color:#7f7fff;">    </span><span style="color:#898887;">*</span><span style="color:#7f7fff;"> DDoc</span>
<span style="color:#7f7fff;">    </span><span style="color:#898887;">*</span>
<span style="color:#7f7fff;">    </span><span style="color:#898887;">*</span><span style="color:#7f7fff;"> Section:</span>
<span style="color:#7f7fff;">    </span><span style="color:#898887;">*</span><span style="color:#7f7fff;"> New section.</span>
<span style="color:#7f7fff;">    </span><span style="color:#898887;">*</span><span style="color:#7f7fff;"> </span><span style="color:#bf5fbf;font-weight:bold;">$(I</span><span style="color:#bf7fff;"> italic</span><span style="color:#bf5fbf;font-weight:bold;">)</span>
<span style="color:#7f7fff;">    </span><span style="color:#898887;">*******/</span>
    <span style="color:#898887;">/+++++++</span>
<span style="color:#7f7fff;">    </span><span style="color:#898887;">+</span><span style="color:#7f7fff;"> DDoc</span>
<span style="color:#7f7fff;">    </span><span style="color:#898887;">+</span><span style="color:#7f7fff;"> /+</span>
<span style="color:#7f7fff;">    </span><span style="color:#898887;">+</span><span style="color:#7f7fff;"> +/</span>
<span style="color:#7f7fff;">    </span><span style="color:#898887;">+++++++/</span>
    
    <span style="color:#898887;">// comments</span>
    <span style="color:#898887;">// </span><span style="color:#ca9219;background-color:#451e1a;font-weight:bold;">FIXME</span><span style="color:#898887;"> </span><span style="color:#81ca2d;background-color:#f7e6e6;font-weight:bold;">NOTE</span>
    <span style="color:#898887;">/* comment */</span>
    <span style="color:#898887;">/+ comment /+ nested comment +/ +/</span>
    
    <span style="color:#898887;">///</span><span style="color:#7f7fff;"> brace folding</span>
    {
    }
    
    <span style="color:#898887;">/**</span><span style="color:#7f7fff;"> normal text</span>
<span style="color:#7f7fff;">    </span><span style="color:#898887;">*</span><span style="color:#7f7fff;"> </span><span style="color:#898887;">---</span>
<span style="font-style:italic;">    </span><span style="color:#898887;">*</span><span style="font-style:italic;"> </span>.x;
<span style="font-style:italic;">    </span><span style="color:#898887;">*</span><span style="font-style:italic;"> </span>..
<span style="font-style:italic;">    </span><span style="color:#898887;">*</span><span style="font-style:italic;"> </span>...
<span style="font-style:italic;">    </span><span style="color:#898887;">*</span><span style="font-style:italic;"> </span>....
<span style="font-style:italic;">    </span><span style="color:#898887;">*</span><span style="font-style:italic;"> </span>.....
<span style="font-style:italic;">    </span><span style="color:#898887;">*</span><span style="font-style:italic;"> </span>_._
<span style="font-style:italic;">    </span><span style="color:#898887;">*</span><span style="font-style:italic;"> </span>_e1
<span style="font-style:italic;">    </span><span style="color:#898887;">*</span><span style="font-style:italic;"> </span><span style="color:#898887;">---</span>
<span style="color:#7f7fff;">    </span><span style="color:#898887;">*/</span>
    
    <span style="color:#898887;">///</span><span style="color:#7f7fff;"> float and int literals</span>
    <span style="color:#0057ae;">int</span> i;
    <span style="color:#0057ae;">real</span> r;
    <span style="color:#0057ae;">ireal</span> ir;
    r = <span style="color:#b08000;">.0</span>;
    r = <span style="color:#b08000;">0f</span>;
    ir = <span style="color:#b08000;">0e0i</span>;
    ir = <span style="color:#b08000;">0.fi</span>;
    r = <span style="color:#b08000;">0.0e0</span>;
    r = <span style="color:#b08000;">0xF.Fp0</span>;
    r = <span style="color:#b08000;">0x_._p0_</span>;
    i = <span style="color:#b08000;">5</span>;
    i = -<span style="color:#b08000;">1</span>;
    i = <span style="color:#b08000;">0b10</span>;
    i = <span style="color:#b08000;">0070</span>;
    i = <span style="color:#b08000;">00</span>;
    i = <span style="color:#b08000;">0xF0</span>;
    
    <span style="color:#898887;">///</span><span style="color:#7f7fff;"> ranges</span>
    <span style="color:#0057ae;">int</span>[] A;
    i = A[<span style="color:#b08000;">1</span>];
    A = A[<span style="color:#b08000;">0</span>..$];
    A = A[<span style="color:#b08000;">0</span>..<span style="color:#b08000;">0</span>];
    A = A[<span style="color:#b08000;">0</span>..length];
    
    <span style="color:#898887;">///</span><span style="color:#7f7fff;"> labels</span>
    label:
    <span style="font-weight:bold;">goto</span> label;
    
    <span style="color:#898887;">///</span><span style="color:#7f7fff;"> function, delegate</span>
    <span style="color:#0057ae;">creal</span> <span style="color:#800000;font-weight:bold;">function </span>() fp = <span style="color:#000080;font-weight:bold;">function</span> <span style="color:#0057ae;">creal</span>() { <span style="font-weight:bold;">return</span> <span style="color:#b08000;">0f</span>+<span style="color:#b08000;">0fi</span>; };
    <span style="color:#0057ae;">void</span> <span style="color:#800000;font-weight:bold;">delegate </span>(<span style="color:#000080;font-weight:bold;">in</span> <span style="color:#0057ae;">int</span> i, <span style="color:#800080;font-weight:bold;">lazy</span> <span style="color:#0057ae;">int</span> b) dg = <span style="color:#000080;font-weight:bold;">delegate</span> <span style="color:#0057ae;">void</span> (<span style="color:#0057ae;">int</span>, <span style="color:#0057ae;">int</span>) {}
    
    <span style="color:#898887;">///</span><span style="color:#7f7fff;"> in, out, body</span>
    <span style="color:#898887;">// </span><span style="color:#81ca2d;background-color:#f7e6e6;font-weight:bold;">NOTE</span><span style="color:#898887;">: highlighting in &amp; out as statements here could be difficult</span>
    <span style="color:#0057ae;">float</span> F ()
    <span style="font-weight:bold;">in </span>{}
    <span style="font-weight:bold;">out </span>(result) {}
    <span style="font-weight:bold;">body</span> {}
    
    <span style="color:#898887;">///</span><span style="color:#7f7fff;"> try, catch, finally</span>
    <span style="font-weight:bold;">try</span> {
        <span style="font-weight:bold;">throw</span> <span style="color:#000080;font-weight:bold;">new</span> <span style="color:#644a9b;font-weight:bold;font-style:italic;">Exception</span>(<span style="color:#bf0303;">&quot;oh no... &quot;</span>);
    } <span style="font-weight:bold;">catch</span> (<span style="color:#644a9b;font-weight:bold;font-style:italic;">Exception</span> e) {
    } <span style="font-weight:bold;">finally</span> {
    }
    
    <span style="color:#898887;">///</span><span style="color:#7f7fff;"> mixin</span>
    <span style="font-weight:bold;">mixin</span>(<span style="color:#bf0303;">&quot;return false;&quot;</span>).<span style="color:#000080;">stringof</span>;
    
    <span style="color:#898887;">///</span><span style="color:#7f7fff;"> templates</span>
    <span style="color:#008000;font-weight:bold;">macro</span>; <span style="color:#898887;">// what does this do?</span>
    <span style="color:#008000;font-weight:bold;">template</span> Tp (T) {
        Tp t;
    }
    Tp!(<span style="color:#0057ae;">int</span>) y;
}
</pre></body></html>
